from resource_management import Script
from resource_management.libraries.resources.xml_config import XmlConfig
from resource_management.libraries.functions.check_process_status import check_process_status
from hdfs import hdfs
from hdfs_dfsrouter import dfsrouter


class DfsRouter(Script):

    def configure(self, env):
        import params
        env.set_params(params)
        hdfs("dfsrouter")
        dfsrouter(action="configure")

    def install(self, env):
        import params
        env.set_params(params)
        self.install_packages(env)

    def start(self, env, upgrade_type=None):
        import params
        env.set_params(params)
        self.configure(env)
        dfsrouter(action="start")

    def stop(self, env, upgrade_type=None):
        import params
        env.set_params(params)
        dfsrouter(action="stop")

    def status(self, env):
        import status_params
        env.set_params(status_params)
        dfsrouter(action="status")


if __name__ == '__main__':
    DfsRouter().execute()

